package beans.factory.support.Impl;

import beans.factory.support.BeanDefinitionReader;
import beans.factory.support.BeanDefinitionRegistry;
import core.io.DefaultResourceLoader;
import core.io.ResourceLoader;

/**
 * @Author: Take-off
 * @Description: TODO 实现前两个获取Bean定义的方法，可以通过外部调用将 Bean 对象 的定义注入并传递到类中
 * @Date: 2023/2/11 4:58 PM
 * @Version: 1.0
 **/
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {
    private final BeanDefinitionRegistry registry;

    private ResourceLoader resourceLoader;

    protected AbstractBeanDefinitionReader(BeanDefinitionRegistry registry) {
        this(registry, new DefaultResourceLoader());
    }

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry, ResourceLoader resourceLoader) {
        this.registry = registry;
        this.resourceLoader = resourceLoader;
    }

    @Override
    public BeanDefinitionRegistry getRegistry() {
        return registry;
    }

    @Override
    public ResourceLoader getResourceLoader() {
        return resourceLoader;
    }
}
